package com.jason.kotlin

import android.content.Intent
import android.os.Bundle
import android.util.Log
import androidx.appcompat.app.AppCompatActivity
import com.jason.kotlin.activityresult.FirstActivity
import com.jason.kotlin.banner.BannerListActivity
import com.jason.kotlin.constraint.ConstraintActivity
import com.jason.kotlin.float.FloatInputActivity
import com.jason.kotlin.immersion.StatusBarActivity
import com.jason.kotlin.notification.NotificationActivity
import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext

class MainActivity : AppCompatActivity() {



    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        getBanner.setOnClickListener {
            startActivity(Intent(MainActivity@this, BannerListActivity::class.java))
        }

        notificationBtn.setOnClickListener {
            startActivity(Intent(MainActivity@this, NotificationActivity::class.java))
        }

        constraintBtn.setOnClickListener {
            startActivity(Intent(MainActivity@this, ConstraintActivity::class.java))
        }

        immersionBtn.setOnClickListener {
            startActivity(Intent(MainActivity@this, StatusBarActivity::class.java))
        }

        contractBtn.setOnClickListener {
            //startActivity(Intent(MainActivity@this, StatusBarActivity::class.java))
            start(FirstActivity::class.java)
        }

        floatInputBtn.setOnClickListener {
            start(FloatInputActivity::class.java)
        }

    }


    private fun start(clazz: Class<out Any>) {
        startActivity(Intent(MainActivity@this, clazz))
    }

    suspend fun loadData(): String {
        var result = ""
        withContext(Dispatchers.IO) {

            for (i in 0..1000000) {

            }
            result = "response"
        }
        return result
    }


}